package LeedCode.guPiao;

import java.net.BindException;

public class Main {
    public int maxProfit(int[]nums){
        int i=0,j=nums.length-1;
        int maxprofit=0;
        for (int left=nums[i],right=nums[j];j>i;i++,j--){
                maxprofit=right-left;
            if (right-left<0){
                return 0;
            }
            else if (maxprofit<nums[i+1]-nums[j-1]){
                maxprofit=nums[i+1]-nums[j-1];
            }
        }
        return maxprofit;
    }
}
